home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <conio.h>
- #include <dir.h>
- #include <dos.h>
- #include <io.h>
- #include "global.h"
- #include "session.h"
- #include "config.h"
-
- extern unsigned char SCREENwidth, SCREENlength;
- #ifdef SCREENSAVER
- int32 LastIO, ScreenSaver;
- static int line, state, delayit, statline;
- int32 secclock ();
-
- #ifdef TNOS_68K
- static WINDOW *saved;
- extern short UseCurses;
- extern chtype MY_NORMAL;
- #endif
-
- #define DELAYVAL 2
-
- void
- screensaver ()
- {
- if (!ScreenSaver)
- return;
- #ifdef TNOS_68K
- if (!UseCurses)
- return;
- #endif
- if (secclock() > (LastIO + ScreenSaver)) {
- if (!state) {
- statline = Current->screen->statline;
- if (statline)
- statLineToggle ();
- state = 1;
- swapscreen (Current, NULLSESSION);
- #ifdef TNOS_68K
- saved = newwin (24, 80, 0, 0);
- wattrset (saved, MY_NORMAL);
- leaveok (saved, 1);
- beep();
- #else
- _setcursortype (_NOCURSOR);
- #endif
- line = delayit = 0;
- }
- if (!delayit++) {
- #ifndef TNOS_68K
- setscreens (0, 7, 1);
- gotoxy (12, ++line);
- line %= SCREENlength;
- printf (" TNOS Screen Saver Active... Press any key to continue ");
- fflush (stdout);
- #else
- werase (saved);
- wmove (saved, line++, 12);
- line %= SCREENlength;
- waddstr (saved, " TNOS Screen Saver Active... Press any key to continue ");
- wrefresh (saved);
- #endif
- }
- delayit %= DELAYVAL;
- } else if (state) {
- #ifdef TNOS_68K
- delwin (saved);
- #endif
- swapscreen (NULLSESSION, Current);
- state = 0;
- #ifndef TNOS_68K
- _setcursortype (_NORMALCURSOR);
- #endif
- if (statline)
- statLineToggle();
- }
- }
-
- /* set the screen saver value */
- int dossaver(argc, argv, p)
- int argc;
- char *argv[];
- void *p;
- {
- LastIO = secclock();
- return setlong(&ScreenSaver,"Screen Saver delay (seconds)",argc,argv);
-
- }
- void
- sskick()
- {
- if (ScreenSaver) {
- LastIO = secclock();
- if (state)
- screensaver();
- }
- }
-
- int
- ssenabled ()
- {
- return state;
- }
-
- #endif /* SCREENSAVER */
-